package com.anywhere.freightman.system.model;

import com.anywhere.freightman.common.BaseModel;
import com.anywhere.freightman.common.enumeration.ResType;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Objects;

@Table(name = "sso_resource")
@Entity
public class Resource extends BaseModel {
    private String displayName;
    private String path;
    private ResType type;
    private Long fid;
    private String code;
    private String icon;

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Long getFid() {
        return fid;
    }

    public void setFid(Long fid) {
        this.fid = fid;
    }

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public ResType getType() {
        return type;
    }

    public void setType(ResType type) {
        this.type = type;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Resource)) return false;
        Resource resource = (Resource) o;
        return Objects.equals(getId(), resource.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId());
    }
}
